package com.youxin.foundation.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

public class ExceptionUtils {
	/**
	 * 获取堆栈详细信息
	 * 
	 * @param t
	 * @return
	 */
	public static String getStackTrace(Throwable t) {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		try {
			t.printStackTrace(pw);
			return sw.toString();
		}catch (Exception e) {
			return "";
		}
		finally {
			try {
				sw.close();
				pw.close();
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
	}
}
